// DataAccessLayer.h
#pragma once
#include <windows.h>
#include "sql.h"
#include "sqlext.h"
#include "sqlncli.h"

using namespace System;

namespace DataAccessLayer {

   public ref class DAL {
   public:

      String ^ActualPrincipal, ^ActualPartner, ^lastSqlState, ^lastErrorMessage;
      int Count, lastNativeError;

      DAL();

      int Connect(String ^primary, String ^Mirror, bool TrackChanges, bool ShowError);
      int Disconnect(bool ShowError);
      int InitTable();
      int DoSomeWork();
      int MirroringFailover();
      int Update(bool ShowError);
      int Commit(bool ShowError);

   private:
      void ODBCError(SQLHANDLE henv, SQLHANDLE hdbc, SQLHANDLE hstmt, bool ShowError);
      SQLHANDLE henv, hdbc; 
      int SavedCount;
   };
}